package collection._04HashSet;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class Demo01 {
    public static void main(String[] args) {
        Set<String> set = new HashSet<>();
        set.add("张三");
        set.add("李四");
        set.add("王五");

        //遍历

        //Iterator遍历
        /*Iterator<String> it = set.iterator();
        while(it.hasNext()) {
            String str = it.next();
            System.out.println(str);
        }*/

        //增强for遍历
        /*for (String str : set) {
            System.out.println(str);
        }*/

        //Lambda表达式遍历
        set.forEach(System.out::println);



    }
}
